// © 2009 Microsoft Corporation.  All rights reserved.
# region Namespaces

using System;
using System.Collections.ObjectModel;
using System.Data;
using System.ServiceModel;
using System.Web.UI.WebControls;
using Microsoft.InformationSecurity.ISRM.Risk.DataEntity;
using Microsoft.InformationSecurity.Risk.DataEntity;
using Microsoft.InformationSecurity.Risk.RiskDataContracts;

#endregion

namespace Microsoft.InformationSecurity.Risk.RiskService
{
    #region interface IManageRisk
    /// <summary>
    /// Interface definition for the Risk Management Service.
    /// </summary>
    [ServiceContract]
    public interface IManageRisk
    {
        #region Interface Method Definition

        /// <summary>
        /// Get all PII Values from the System.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Collection<ListItem> GetPIIOptions();

        /// <summary>
        /// Get all Risk Groups from the System.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Collection<ListItem> GetRiskGroups();

        /// <summary>
        /// Get all the location data from the system.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Collection<ListItem> GetLocations();

        /// <summary>
        /// Get all the ERM classification data from the system.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Collection<ListItem> GetOERMClassifications();

        /// <summary>
        /// Get all the dataClassification data from the system.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Collection<ListItem> GetDataClassifications();

        /// <summary>
        /// Get all the notes for the risk.
        /// </summary>
        /// <param name="riskID">Risk Identifier</param>
        /// <returns></returns>
        [OperationContract]
        Collection<NoteData> GetNotes(int riskID);

        /// <summary>
        /// Get all the Risk Origin options from the system.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Collection<ListItem> GetRiskOrigin();

        /// <summary>
        /// Get all Risk Status options from the system.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Collection<ListItem> GetRiskStatusOptions();

        /// <summary>
        /// Get all the risk impact options from the system.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Collection<ListItem> GetRiskImpactOptions();

        /// <summary>
        /// Get all Risk Control Effectiveness Options from the system.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Collection<ListItem> GetRiskCAOptions();

        /// <summary>
        /// Get all the Risk Frequency optiosn from the system.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Collection<ListItem> GetRiskFrequencyOptions();

        /// <summary>
        /// Submit a risk in the system.
        /// </summary>
        /// <param name="riskInstance">Risk Object</param>
        /// <param name="submittedbyFullName">full name of person who submitted the risk</param>
        /// <returns></returns>
        [OperationContract]
        int SubmitRisk(RiskData riskInstance, out string submittedbyFullName);

        /// <summary>
        /// Get Master History records of the changes commited to the system like Date | FullName.
        /// </summary>
        /// <param name="riskID">Risk Identifier</param>
        /// <returns></returns>
        [OperationContract]
        Collection<History> GetMasterHistoryData(int riskID);

        /// <summary>
        /// History detail for the risk.
        /// </summary>
        /// <param name="riskID">Risk Identifier</param>
        /// <param name="createdDate">Date</param>
        /// <param name="personID">Person Identifier</param>
        /// <returns></returns>
        [OperationContract]
        Collection<HistoryDetail> GetDetailsHistoryData(int riskID, DateTime createdDate, int personID);

        /// <summary>
        /// Get Incident list from the system.
        /// </summary>
        /// <param name="riskID">Risk Identifier</param>
        /// <param name="sort">Sorting Identifier</param>
        /// <param name="dir">Direction of sorting - ASC or DESC</param>
        /// <returns></returns>
        [OperationContract]
        Collection<Incident> GetIncidentList(int riskID, string sort, string dir);

        /// <summary>
        /// Get Single Incident data.
        /// </summary>
        /// <param name="riskID">Risk Identifier</param>
        /// <param name="incidentID">Incident Identifier</param>
        /// <returns></returns>
        [OperationContract]
        Incident GetSingleIncidentData(int riskID, int incidentID);

        /// <summary>
        /// Insert single incident into system.
        /// </summary>
        /// <param name="riskID">Risk Identifier</param>
        /// <param name="title">Incident Title </param>
        /// <param name="desc">Incident Description</param>
        /// <param name="submittedby">Submitted by</param>
        [OperationContract]
        void InsertIncident(int riskID, string title, string desc, int submittedby);

        /// <summary>
        /// Update the incident.
        /// </summary>
        /// <param name="riskID">Risk Identifier</param>
        /// <param name="title">Incident Title.</param>
        /// <param name="desc">Incident Description</param>
        /// <param name="updatedBy">Incident Updated by</param>
        /// <param name="incidentID">IncidentID Identifier</param>
        [OperationContract]
        void UpdatetIncident(int riskID, string title, string desc, int updatedBy, int incidentID);

        /// <summary>
        /// Get Calculated Current Risk Data for chart.
        /// </summary>
        /// <param name="riskID">Risk Identifier.</param>
        /// <param name="flagforFilter">Flag for filter</param>
        /// <returns></returns>
        [OperationContract]
        DataSet GetCalculatedCRVDataSet(int riskID, int flagforFilter);

        /// <summary>
        /// Get the root level of the Organization tree.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        Collection<OrganizationData> GetRootLevel();

        /// <summary>
        /// Get nodes for any level specified through organization ID.
        /// </summary>
        /// <param name="organizationID">OrganizationID</param>
        /// <returns></returns>
        [OperationContract]
        Collection<OrganizationData> GetNextLevelOrganizations(int organizationID);

        /// <summary>
        /// Get TOP N users from system based on first few characters in alias.
        /// </summary>
        /// <param name="alias">Charaters in alias.</param>
        /// <returns></returns>
        [OperationContract]
        Collection<string> GetTOPNAliases(string alias);

        /// <summary>
        /// Get Orgnaization-Contact XML.
        /// </summary>
        /// <param name="orgaizationlist">List of Organizations mapped to Risk.</param>
        /// <param name="personlist">List of people mapped to Risk.</param>
        /// <returns></returns>
        [OperationContract]
        OrganizationContact GetOrganizationContactXML(string orgaizationlist, string personlist);

        /// <summary>
        /// Get person ID for the user.
        /// </summary>
        /// <param name="alias">Alias for the person.</param>
        /// <returns></returns>
        [OperationContract]
        object GetPersonID(string alias);

        /// <summary>
        /// Get Current Risk Rating Value.
        /// </summary>
        /// <param name="impact">Impact Value.</param>
        /// <param name="frequency">Frequency Value.</param>
        /// <param name="controlAffectiveness">Control Effectiveness Value.</param>
        /// <returns></returns>
        [OperationContract]
        object GetCRV(int impact, int frequency, int controlAffectiveness);

        /// <summary>
        /// Get Risk Rating from the system based on algorithm.
        /// </summary>
        /// <param name="impact">Impact Value.</param>
        /// <param name="frequency">Frequency Value.</param>
        /// <param name="controlAffectiveness">Control Effectiveness Value.</param>
        /// <returns></returns>
        [OperationContract]
        object GetRiskRating(int impact, int frequency, int controlAffectiveness);

        /// <summary>
        /// Get priortized current risk value.
        /// </summary>
        /// <param name="crv">CRV value.</param>
        /// <param name="wt">Wieght value</param>
        /// <returns></returns>
        [OperationContract]
        object GetPCRV(int crv, Decimal wt);

        [OperationContract]
        RiskInformation GetRiskInformation(int riskId);

        /// <summary>
        /// Update the risk into the system.
        /// </summary>
        /// <param name="riskInstance">Risk object</param>
        /// <returns></returns>
        [OperationContract]
        int UpdateRisk(RiskData riskInstance);

        /// <summary>
        /// Gets the count of records for the Basic Search filter criteria.
        /// </summary>
        /// <param name="fieldName">Fieldname to filter by</param>
        /// <param name="fieldoperator">Operator</param>
        /// <param name="value1">filter value.</param>
        /// <param name="value2">filter value used by To Date only</param>
        /// <param name="personID">Person doing the search.</param>
        /// <param name="isRoleFilter">Do we filter by role.</param>
        /// <param name="sortField">Sort by field value.</param>
        /// <param name="sortAscDesc">Sort Direction.</param>
        /// <param name="pageSize">Page Size ex. 20</param>
        /// <param name="startIndex">Page Index. Ex 7</param>
        /// <returns></returns>
        [OperationContract]
        Collection<RiskInformation> BasicSearchRisk(string fieldName, string fieldoperator, string sortField, int sortAscDesc, int pageSize, int startIndex, string value1, string value2, int personID, int isRoleFilter);

        /// <summary>
        /// Gets the count of records for the Basic Search filter criteria.
        /// </summary>
        /// <param name="fieldName">Fieldname to filter by</param>
        /// <param name="fieldoperator">Operator</param>
        /// <param name="value1">filter value.</param>
        /// <param name="value2">filter value used by To Date only</param>
        /// <param name="personID">Person doing the search.</param>
        /// <param name="isRoleFilter">Do we filter by role.</param>
        /// <returns></returns>
        [OperationContract]
        int BasicSearchRiskCount(string fieldName, string fieldoperator, string value1, string value2, int personID, int isRoleFilter);

        /// <summary>
        /// Get the Risk Manager from system from specific risk.
        /// </summary>
        /// <param name="riskId">Risk Identifier</param>
        /// <returns></returns>
        [OperationContract]
        ListItem GetRiskManager(int riskId);


        /// <summary>
        /// Get general stats from the system.
        /// </summary>        
        /// <returns></returns>
        [OperationContract]
        GeneralStats GetGeneralStats();

        #endregion
    }
    #endregion
}
